//
//  MCGoodsCategoryFooterView.swift
//  StoreManage
//
//  Created by MC on 2018/9/11.
//  Copyright © 2018年 MC. All rights reserved.
//

import UIKit

class MCGoodsCategoryFooterView: UIView {

    
    var model = MCGoodsCategoryModel() {
        didSet {
            nameLabel.text = model.name
            numberLabel.text = "（" + model.goodsNum.stringValue + "）"
        }
    }

    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        
        self.frame = CGRect.init(x: 0, y: 0, width: MCScreenWidth, height: 62)
        backgroundColor = UIColor.white
        
        self.addSubview(lineView)
        self.addSubview(nameLabel)
        self.addSubview(numberLabel)
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override func layoutSubviews() {
        super.layoutSubviews()
        
        lineView.snp.remakeConstraints { (make) ->Void in
            make.left.right.top.equalTo(self)
            make.height.equalTo(7)
        }
        
        nameLabel.snp.remakeConstraints { (make) ->Void in
            make.left.equalTo(15)
            make.centerY.equalTo(self)
        }
        
        numberLabel.snp.remakeConstraints { (make) ->Void in
            make.left.equalTo(nameLabel.snp.right).offset(3)
            make.centerY.equalTo(self)
        }
    }

    private lazy var lineView: UIView = {
        let view = UIView()
        view.backgroundColor = UIColor.MCGray_light
        return view
    }()
    
    private lazy var nameLabel: MCLabel = {
        let label = MCLabel()
        label.font = MCFont(15)
        label.text = "XXX"
        return label
    }()
    
    public lazy var numberLabel: MCLabel = {
        let label = MCLabel()
        label.font = MCFont(13)
        label.textColor = UIColor.MCGray_middle
        label.text = "（0）"
        return label
    }()

}
